<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<script type="text/javascript">
		let arr = [1, 2, 4, 5, 6, 19, 33]
		let sum = 0
		//循环数组
		for (let i = 0; i < arr.lenght; i++){
			console.log(arr[i])
			sum += arr[i]
		}
		console.log(sum)

		//forEach() 遍历
		// arr.forEach()
		let add = 0
		arr.forEach(function(value, index, array){
			/*
				value, index, array
				value:数组每一项的值
				index:数组每一项的下标
				array:原数组
			*/
			console.log("value---", value, "index---", index, "原数组---", array)
			add += value
		})
		console.log(add)
	</script>
</body>
</html>